home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 5
/
Aminet 5 - March 1995.iso
/
Aminet
/
util
/
cli
/
bangtools.lha
/
USAGE
< prev
Wrap
Text File
|
1995-01-15
|
4KB
|
86 lines
CALLFUNC - Shell command to call shared library functions.
Usage:
a) callfunc open <libname> [version <n>]
Open a library and print its base. Use it like this:
set intuibase `callfunc open intuition.library`
Sets a WARN returncode if the library could not be opened.
Don't forget to close the library later in your script!
b) callfunc close <libbase>
Closes a library. Example:
callfunc close $intuibase
Sets a WARN returncode if the base is invalid.
c) callfunc <offset> from <libname/libbase> [D0=<val>] [D1=<val> etc] [A0=<val>] [A1=<val> etc] [void]
Call a library function. If the 'from' argument can be interpreted as
a library base it is used, otherwise it is interpreted as a library name:
callfunc 96 from $intuibase void
Calls DisplayBeep() with the previously opened
intuition.library.
callfunc 96 from intuition.library void
Opens intuition.library, calls DisplayBeep() and closes the
library.
Prints the value that is returned from the function in D0, unless
the 'void' keyword is used. The offset must be decimal and can be
positive or negative. Register values can be given as decimal,
hex (prefix 0x) or octal (prefix 0) numbers, or strings (prefix @).
All registers are set to 0 as default. For strings, the register
is loaded with the address of the characters after the '@'; for
example, this is a replacement for the AmigaDOS "rename" command:
callfunc 78 from dos.library D1 @oldname D2 @newname
A more sophisticated example:
set execbase `callfunc open exec.library`
set mem `callfunc 198 from $execbase D0=200 D1=0x01` ; mem = AllocMem(200, MEMF_PUBLIC)
memcopy "Hello World*N" to $mem ; strcpy(mem, "Hello world\n")
callfunc 948 from dos.library D1=$mem void ; PutStr(mem)
callfunc 210 from $execbase A1=$mem D0=200 void ; FreeMem(mem, 200)
callfunc close $execbase
-----------------------------------------------------------------------------
MEMCOPY - copy memory contents, or a string into memory
Usage:
a) memcopy from <addr1> to <addr2> [num <n>]
Copy upto <n> bytes of memory from <addr1> to <addr2>.
If no number if given, copies until a 0-byte is encountered
(including this byte). This mode is used if <addr1> can be
interpreted as an address (is a number, either decimal, octal
(prefix 0) or hexadecimal (prefix 0x)).
b) memcopy <string> to <addr> [num <n>] [string]
Copy <string> into memory at <addr>.
This mode is used if the first argument cannot be interpreted
as an address, or the keyword "string" is used.
See callfunc for an example.
-----------------------------------------------------------------------------
PEEK - read value from memory
POKE - wite a value to memory
Usage:
peek <addr> [BYTE|B|S|SHORT|W|WORD|L|LONG] [H|X|HEX]
Reads the value from memory location <addr> and print it as decimal or
hexadecimal (keyword "X", "H", or "HEX"). Reads either a byte (default,
or keyword "B" or "BYTE"), a 16bit-value (keyword "S", "SHORT", "W" or
"WORD") or a 32bit-value (keyword "L" or "LONG").
Remember that reading a 16bit- or 32bit-value from an odd address results
in a bus error on 68000 CPUs.
poke <addr> <value> [BYTE|B|S|SHORT|W|WORD|L|LONG]
Write a value to memory. The flags have the same meaning as for "peek".